import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
Vue.use(VueRouter)

const routes = [
  {
    //这是主路由
    path:'/',
    name:'hom',
    component:HomeView,
    //重定向
    redirect:'/movie',
    //子路由
    children:[
      { 
          //创建电影路由
           path:'movie',
           name:'movie',
           component: () => import(/* webpackChunkName: "about" */ '../views/Movie.vue'),
           //重定向到movie下面的子路由hot
            redirect:'/movie/hot',
            //movie下面的子路由
           children:[
            {
              //创建正在热映路由
              path:'hot',
              name:'hot',
              component: () => import(/* webpackChunkName: "about" */ '../views/Hot.vue'),
             
            },
            {
              //创建即将上映路由
              path:'soon',
              name:'soon',
              component: () => import(/* webpackChunkName: "about" */ '../views/Soon.vue'),

            }
           ]
      },
      {
        //创建影院路由
        path:'/cinema',
        name:'cinema',
        component: () => import(/* webpackChunkName: "about" */ '../views/CiNema.vue')
      },
      {
        //创建资讯路由
        path:'news',
        name:'news',
        component: () => import(/* webpackChunkName: "about" */ '../views/News.vue')

      },
      {
        //创建我的路由
        path:'my',
        name:'my',
        component: () => import(/* webpackChunkName: "about" */ '../views/My.vue')
      },
     
    ]

  },
  {
    //创建电影详情路由带id参数
    //id是对应的电影
    path:'/film/:id',
    name:'film',
    component: () => import(/* webpackChunkName: "about" */ '../views/Film.vue'),
  },
  {
    //创建城市列表路由
    path:'/city',
    name:'city',
    component: () => import(/* webpackChunkName: "about" */ '../views/City.vue')
  },
  {
    //创建影院详情路由
    //id 是电影院id
    //did是对映影片的id
    path:'/cinemaInfo/:id/:did',
    name:'cinemaInfo',
    component: () => import(/* webpackChunkName: "about" */ '../views/CinemaInfo.vue'),
   //创建子路由
    children:[
     {
      //创建影片场次路由
       path:':theTimeParameter',
       component: () => import(/* webpackChunkName: "about" */ '../views/PlaySchedule.vue'),
     }
    ]
  }
  
 
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
